<?php $this->load->view('teacher_home/_header') ?>
<?php $this->load->view('message') ?>
<script type="text/javascript">
  $().ready(function(){
    $("#module_li").addClass("active"); 

    $('.selectpicker').selectpicker({});


    $("#relative_test_points_select").selectpicker('val',[
<?php foreach ($relative_test_points as $item ): ?>
<?=$item['id']?>,
<?php endforeach ?>
        0]);
    $("#module_edit_form").validate({
        rules:{
            module_name:
            {
                required:true,
                maxlength:200
            }
        }
    });   
  });
</script>

<div class="container">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">自定义考卷</h3>
        </div>
        <div class="panel-body">
            <form id="module_edit_form" method="post" class="form-horizontal"  enctype="multipart/form-data" action="<?php echo site_url('teacher_module/editModule')?>" >
                <input type="text" id="module_type" name="module_type" value="1" class="hidden">
                <input type="text" id="module_id" name="module_id" value="<?=$module['id']?>" class="hidden">
                <fieldset>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">名称:</label>
                        <div class="col-lg-8">
                            <input class="form-control" id="module_name" name="module_name" value="<?=$module['name']?>"/></div>

                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">考试时间:</label>
                        <div class="col-lg-8">
                            <select class="form-control" name="module_time_limit" id="module_time_limit">
                                <?php for($i=5; $i<=100 ;$i+=5) :?>
                                <option value="<?=$i?>"
                                    <?php if($i==$module['time_limit']) echo "selected='true'"?>
                                >
                                    <?=$i?>分钟</option>
                                <?php endfor; ?></select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">相关考点:</label>
                        <div class="col-lg-8">

                            <select id="relative_test_points_select" class="selectpicker form-control" multiple data-live-search="true" data-style="btn-primary" multiple data-selected-text-format="count" name="relative_test_points[]">
                                <?php foreach ($test_points as $item ): ?>
                                <option value="<?=$item['id']?>">
                                    <?=$item['content']?></option>
                                <?php endforeach ?>
                            </select>

                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-lg-2 control-label"></label>
                        <div class="col-lg-8">
                            <?php foreach ($relative_test_points as $item ): ?>
                                <?=$item['content']?> <br />
                            <?php endforeach ?>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-lg-10 col-lg-offset-2">
                            <button type="submit" class="btn btn-primary">提交</button>
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
</div>

<?php $this->load->view('teacher_home/_footer')?>